<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
   /*  function fn(){
        console.log(this); // window
    }
    fn();

    var zhang = {
        name:"张三",
        age:18,
        say:function(){
            console.log(this);
            console.log(this.name,this.age);
        }
    }

    zhang.say();   // this -> zhang


     */

  


    document.onclick = function(){
        console.log(this); // document

        var fn = () => {
            console.log(this); // document
        }
        fn();
    }


    var zhang = {
        name:"张三",
        age:18,
        say:function(){
            console.log(this);  // zhang
            
            var fn = () => {
                console.log(this); // zhang
            }
            fn();

        }
    }

    zhang.say();   // this -> zhang


 


</script>
</html>